<?php

namespace App\Http\Controllers\Dashboard;


use App\Http\Controllers\Common\Internal;
use App\Models\CityTicket;
use App\Models\LoanApplication;
use App\Models\LoanTypeList;
use App\Models\YqArea;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\DB;


class WebSettingController extends BaseController
{
    /**
     * @param Request $request
     * @param $key
     * @return JsonResponse
     */
    public function get(Request $request, $key) {
        return response()->json([
            'msg' => "ok",
            'code' => 0,
            'data' => web_setting($key),
        ]);
    }

    /**
     * @param Request $request
     * @param $key
     * @return JsonResponse
     */
    public function save(Request $request, $key) {
        if (app_setting([$key => $request->value])) {
            return response()->json([
                'msg' => "ok",
                'code' => 0,
                'data' => web_setting($key),
            ]);
        } else {
            return response()->json([
                'msg' => "ok",
                'code' => 0,
                'data' => null,
            ]);
        }
    }








}
